package drds.server.sqlparser.sqlobject.statement.query;

import drds.server.sqlparser.sqlobject.statement.StatementImpl;
import drds.server.sqlparser.visitor.Visitor;

/**
 * 
 * @author 曹正辉<330937205@qq.com>
 * 
 */
public class SelectStatement extends StatementImpl {

	protected SubQuery subQuery;

	public SelectStatement() {

	}

	public SelectStatement(SubQuery subQuery) {
		this.setSubQuery(subQuery);
	}

	public void setSubQuery(SubQuery subQuery) {
		if (subQuery != null) {
			subQuery.setParent(this);
		}
		this.subQuery = subQuery;
	}

	public void output(StringBuffer sb) {
		this.subQuery.output(sb);
	}

	public SubQuery getSubQuery() {
		return this.subQuery;
	}

	protected void accept0(Visitor visitor) {
		if (visitor.visit(this)) {
			acceptChild(visitor, this.subQuery);
		}
		visitor.endVisit(this);
	}
}
